//
//  ReadSettingView.swift
//  WalkNovel
//
//  Created by Kevin on 2023/7/14.
//

import UIKit

class ReadSettingView: UIView {
    
    lazy var brightnessView: ReadBrightnessView = {
        let view = ReadBrightnessView()
        return view
    }()
    
    lazy var fontView: ReadFontView = {
        let view = ReadFontView()
        return view
    }()

    lazy var flipView: ReadFlipView = {
        let view = ReadFlipView()
        return view
    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        addSubview(brightnessView)
        addSubview(fontView)
        addSubview(flipView)
        brightnessView.snp.makeConstraints { make in
            make.top.equalTo(15)
            make.left.equalTo(20)
            make.right.equalTo(-20)
            make.height.equalTo(36)
        }
        fontView.snp.makeConstraints { make in
            make.top.equalTo(brightnessView.snp.bottom).offset(12)
            make.left.equalTo(20)
            make.right.equalTo(-20)
            make.height.equalTo(180)
        }
        flipView.snp.makeConstraints { make in
            make.top.equalTo(fontView.snp.bottom).offset(12)
            make.left.equalTo(20)
            make.right.equalTo(-20)
            make.height.equalTo(44)
        }
        wn_cornerWithBorder(8, 0, .white, 1, .init(white: 0, alpha: 0.1), .init(width: 0, height: 1), 5)
        layer.masksToBounds = false
    }
    
    func darkModeConfig() {
        backgroundColor = isDark() ? .init(named: "black_222222") : .white
        brightnessView.darkModeConfig()
        fontView.darkModeConfig()
        flipView.darkModeConfig()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
